package state;

import development.Global;

public abstract class Control extends Thread {
  private GameForm parent;
  
  public void setParent(GameForm parent) {
    this.parent = parent;
  }
  
  public boolean isContinute() {
    return parent.isRunning;
  }

  public void run() {
    try {
      perform();
    } catch (OutOfMemoryError e) {
      GameGlobal.systemCanvas.processOnOutOfMemory();
    } catch (RuntimeException ex) {
      if (Global.systemCanvas.isDebugMode()) {
        ex.printStackTrace();
      }
    }
  }
  
  public abstract void perform();
}
